<%@ page import="java.util.Date" %><%--
  Created by IntelliJ IDEA.
  User: oldliu
  Date: 2022-03-26
  Time: 17:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
  <%
      request.setAttribute("str","<script>while(true)alert('你好');</script>");
      request.setAttribute("age",12);
      request.setAttribute("arr",new String[]{"小狗","小猫","兔子","蝗虫","蜘蛛"});

      request.setAttribute("now",new Date());
  %>
<%-- ${str}--%>
<c:out value="${str}"/>
<h1>
    <c:if test="${age>=18}">
        成年人
    </c:if>
    <c:if test="${age<18}">
        未成年人
    </c:if>
</h1>
  <h1>
      <c:choose>
          <c:when test="${age>=60}">
              老年人
          </c:when>
          <c:when test="${age>=45}">
              中年人
          </c:when>
          <c:when test="${age>=18}">
              青年人
          </c:when>
          <c:otherwise>
              未成年
          </c:otherwise>
      </c:choose>
  </h1>
<ul>
    <c:forEach items="${arr}" var="i">
        <li>${i}</li>
    </c:forEach>

</ul>
<h2>
    ${now}<br/>
    <fmt:formatDate value="${now}" pattern="yyyy年MM月dd日"/>
</h2>

  <hr size="49" color="red">
<c:forEach begin="1" end="40" step="1" var="i" varStatus="s">
    ${s.index}:${i},是不是最后一个${s.last}<br/>
</c:forEach>
</body>
</html>
